UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/6NhEOU6N6qo1ZiowO481bOck7iJcnM5d+laJfLPO8Q=' 
WHERE 
  key_id = '1877115b36d5f37784cd77dc8240218eea96d0bd405242a611de63b8765a8744' 
  AND (
    token = '/6NhEOU6N6qo1ZiowO481bOck7iJcnM5d+laJfLPO8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037