UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yX98xR5jLEhNZQpZKzpragMQeUTGU7AS7GGCBE2D+3E=' 
WHERE 
  key_id = 'a30e5649f8fea44ab1902612ae604c7e8bfb693077f79e47097fa61d095e657f' 
  AND (
    token = 'yX98xR5jLEhNZQpZKzpragMQeUTGU7AS7GGCBE2D+3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022