UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'av1iiJXulBSiCrmsWJiFf6mi01JUt5InleDXVnfyLZI=' 
WHERE 
  key_id = 'e6d443702c3e44731995f7a51cf564d4b8af0bc6367ec23922a55915b13bf3c5' 
  AND (
    token = 'av1iiJXulBSiCrmsWJiFf6mi01JUt5InleDXVnfyLZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034