UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OjHQkZUdzd1kINmI29EKv5qGm7MBE/7Ye1K3ElS1LWY=' 
WHERE 
  key_id = '8b96148a49d6cda610e566d8b46c221166e18101272b10d11b0a32aa6a833a54' 
  AND (
    token = 'OjHQkZUdzd1kINmI29EKv5qGm7MBE/7Ye1K3ElS1LWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042