UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0CK0kWMdFtYDxL3R8uMwjA2ROGWQMpyick/zwfmBUR4='
WHERE
key_id = '1643b665979d73d35d3a9f26566892f2940ad329f0939f60e8bb7dc107f99bdd'
AND (
token = '0CK0kWMdFtYDxL3R8uMwjA2ROGWQMpyick/zwfmBUR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)