UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Jt6VtT/Gfn1/kx3noaeDlZfcSFVp1qqYYSBcnCNnEs=' 
WHERE 
  key_id = '476a4a272719345d37d31388cb977749b58e6437dd189d4f6f373a15a210dafe' 
  AND (
    token = '2Jt6VtT/Gfn1/kx3noaeDlZfcSFVp1qqYYSBcnCNnEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049