UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BaQXJBNL6c49FKf5t/Z998VhQhRZk1vEr7M4SgjglGw=' 
WHERE 
  key_id = 'e450a39098fb4ca5d73773ae85c34fb3aa289b43368ad2a308086480b78a4160' 
  AND (
    token = 'BaQXJBNL6c49FKf5t/Z998VhQhRZk1vEr7M4SgjglGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023