UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l64D+Dv0HFAVpjQN4O5BstrGJ039jQ4vCOVC/A5uCAg=' 
WHERE 
  key_id = 'c03bcd99c15626d9d8016539ac28d098b666756fc54d67b4b8f6f6c88f342f0a' 
  AND (
    token = 'l64D+Dv0HFAVpjQN4O5BstrGJ039jQ4vCOVC/A5uCAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039