UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cjn/3PfqyZ50bpdS4djOqOoU1xHpWYgMA8e+Nec/NUE='
WHERE
key_id = 'b3d93f63c7328f89de1e529da3b6964d24985c3e3276a5a771f3ae96d3ced584'
AND (
token = 'cjn/3PfqyZ50bpdS4djOqOoU1xHpWYgMA8e+Nec/NUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)