UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKv29erO6Tww52xvRy0+t7Hc7VB/XtB7nNGLgb0nxa4='
WHERE
key_id = 'e1b57e3e320e3f3e1d57da6504a21563f62bd70700197eff64da7c245a538881'
AND (
token = 'gKv29erO6Tww52xvRy0+t7Hc7VB/XtB7nNGLgb0nxa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)