UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UddEGc8K1IFRiyPBFxFKunh3L1n8MyM2Of3ZpJvx12w='
WHERE
key_id = 'a602df39a53951a922a631a9df289e799006e0917e773f7dc5a63d16e98abe84'
AND (
token = 'UddEGc8K1IFRiyPBFxFKunh3L1n8MyM2Of3ZpJvx12w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)