UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aEmw2SwUb7s5dik9yx9uAuEpUVxQJ4Nt3xpc7w6y6O8=' 
WHERE 
  key_id = '11238d60ea30beffb854682e37f9688d50cab20f81a83dfa6ddaf4b079be9d37' 
  AND (
    token = 'aEmw2SwUb7s5dik9yx9uAuEpUVxQJ4Nt3xpc7w6y6O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025