UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kx2mLoj1R8X8Vc4Bo5A8QUK93rHMLw6LVgndy/G8DGY='
WHERE
key_id = '798aec6cc45f2472569bfa242fae00d6bb8fba099d723bb0a6a346751848a524'
AND (
token = 'Kx2mLoj1R8X8Vc4Bo5A8QUK93rHMLw6LVgndy/G8DGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)