UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k8LLxuyYOw2qV3PoyPRrXmwUIoOxu6uPOKd3KnmgZYo=' 
WHERE 
  key_id = '678d78dc4e16793088230a30e81b60c4db2a1c39510a5376be97ccae9905d733' 
  AND (
    token = 'k8LLxuyYOw2qV3PoyPRrXmwUIoOxu6uPOKd3KnmgZYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034