UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Avb6rw/pYF1n4Np2NVkbeHleXsAciiu9JnjIMVNRVxs=' 
WHERE 
  key_id = '15a9ad0994f13064a6ce4e7e0d3c5c57530c1a56440a212d99441d49ea15f9f6' 
  AND (
    token = 'Avb6rw/pYF1n4Np2NVkbeHleXsAciiu9JnjIMVNRVxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023