UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aOhhFwXvhoptU+jUyeMLxNTjt4lG3bQ1XdGiopV4v8w='
WHERE
key_id = 'e69b8ecacb253e22242381ff6b0cee2486fff0a852d1c082b3923b4b1f4465d0'
AND (
token = 'aOhhFwXvhoptU+jUyeMLxNTjt4lG3bQ1XdGiopV4v8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)