UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OkiXVzGpOAGz5LV3WRFqhqijCevFcDzpW3ifxISeDc4='
WHERE
key_id = 'd647754e02eba5120a95db393000bb1d1e2e3eff5992cad40a4bc43e293175d7'
AND (
token = 'OkiXVzGpOAGz5LV3WRFqhqijCevFcDzpW3ifxISeDc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)