UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GXITDoXIhJPpmc38DDMkP8WHM+6hVN22es3+urXgOjg=' 
WHERE 
  key_id = '88d720684c0362ea38fc4ba2957ec8db497f566473ce83585d17ea22409d0876' 
  AND (
    token = 'GXITDoXIhJPpmc38DDMkP8WHM+6hVN22es3+urXgOjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021