UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nJd9JA03zvvWdskpbnxz+JFBk5R81b4iYmZkcaHdCek=' 
WHERE 
  key_id = 'dcc5abc90a927fbd422df7bc6a0245dd10738a776e6850b4fe99cc3c67087c32' 
  AND (
    token = 'nJd9JA03zvvWdskpbnxz+JFBk5R81b4iYmZkcaHdCek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028