UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7UdJqzTyjBZJs5auhoruzVNrd2N7cRlMP9eEbhmrphU=' 
WHERE 
  key_id = '7da29589856b117cae092d04615ab7899fd3dc8a227c7f162a1e1bea2161f4ca' 
  AND (
    token = '7UdJqzTyjBZJs5auhoruzVNrd2N7cRlMP9eEbhmrphU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044