UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k7APNc5huzasfQXn3szTM7B/6DBvx1ZdNfNoO5s82hk='
WHERE
key_id = '12bc64d8a35603cfef9b221af6b59e0f01bfbf745ef3d174b10b7c6f293f4ba3'
AND (
token = 'k7APNc5huzasfQXn3szTM7B/6DBvx1ZdNfNoO5s82hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)