UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fka+NUFRZIjkyzVxHEpz7lrIjUpRUDZYnESlRD8qa8o=' 
WHERE 
  key_id = 'f86f46a0665c77f56b340cb70f550003405563e57a9f26818df19ad2390edcf4' 
  AND (
    token = 'fka+NUFRZIjkyzVxHEpz7lrIjUpRUDZYnESlRD8qa8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083