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