UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '99cTcYVP1TMExBxo1v847metiFpd46Uwp49k5PRZVpA=' 
WHERE 
  key_id = '4a5e8a0b3341b65100597100f7dd0f493b9f3954f704e052de9821b1d825823a' 
  AND (
    token = '99cTcYVP1TMExBxo1v847metiFpd46Uwp49k5PRZVpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039