UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pQj0KTxo7zLjFv1OLFUYD+uJyKjP0VwIs0GHZ9RwZPA=' 
WHERE 
  key_id = '307294485400d4db5148f0632e6448b2fa95fe811bede777318291c028856c4d' 
  AND (
    token = 'pQj0KTxo7zLjFv1OLFUYD+uJyKjP0VwIs0GHZ9RwZPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016