UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CVXSdSW9TZRichdT6zYM8O+FIVjIVApRFPioGGq1GkQ=' 
WHERE 
  key_id = 'a2d1170bc90bf1ff6e7244b6eff67c045be74e720a0eb2a15d9988d4e75ebb66' 
  AND (
    token = 'CVXSdSW9TZRichdT6zYM8O+FIVjIVApRFPioGGq1GkQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034