UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KPXyikW3Fj31ZFkbICR5LOC+RFYxw0OVVpF61DIrhk4='
WHERE
key_id = 'f83da828a5cabc7836ddaa076ad8a00dc614258f6d21903e07f4c489ae270a73'
AND (
token = 'KPXyikW3Fj31ZFkbICR5LOC+RFYxw0OVVpF61DIrhk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)