UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YyOWNinBDqz+djYDL4sKHpW6EPNjl+kztwn+RNHyCvE=' 
WHERE 
  key_id = '2fe450e4a7308880e25ad5e284b65b0b0d72d016590acb4235c3b6358fdcd846' 
  AND (
    token = 'YyOWNinBDqz+djYDL4sKHpW6EPNjl+kztwn+RNHyCvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041