UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1vA4YDIshngoqLUEMwP1vCUNX3w6KcaeYL5zDkrkd+M=' 
WHERE 
  key_id = '86289872056f2d04282ab0b5c17dad0f045e545fcff57bcd4ca050d81da0058a' 
  AND (
    token = '1vA4YDIshngoqLUEMwP1vCUNX3w6KcaeYL5zDkrkd+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050