UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h6+AlkE7WoGSdVfhW8XAJkHMU0lDAN66K3ytaj3n1sg=' 
WHERE 
  key_id = 'e966c6f015ff9d8e04c63b4ae1d6eb17a140b60f86f0006322c471b34796541e' 
  AND (
    token = 'h6+AlkE7WoGSdVfhW8XAJkHMU0lDAN66K3ytaj3n1sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036