UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/vXO36H4C4y5hk8kFdQtEG9TaA6PrUAr8pO/Upc0oD4=' 
WHERE 
  key_id = '063c51810bb8e32a95da04b486695b7050466667f082c0f96ff46971e31825e1' 
  AND (
    token = '/vXO36H4C4y5hk8kFdQtEG9TaA6PrUAr8pO/Upc0oD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050