UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '998P2tdaomu7N7vRO297uCw4ZGnM3OUAj7pQA9gk4lI=' 
WHERE 
  key_id = 'b7bb5cb64b23b7a1114f5a0e5b456ed0645f05d92f432997fd6af471c24e18c4' 
  AND (
    token = '998P2tdaomu7N7vRO297uCw4ZGnM3OUAj7pQA9gk4lI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030