UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pMvVaz+5pAL2ERwBO3oeEpPvMhPBb1fs0+sPnIKNyc0=' 
WHERE 
  key_id = 'cdaad1a0e248cd872ac70dc0d1d7e6696e4734903de1228638e8cb716e8b9537' 
  AND (
    token = 'pMvVaz+5pAL2ERwBO3oeEpPvMhPBb1fs0+sPnIKNyc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036