UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q2P5pDAEIaaR1oK9EZgKjueukVDvp+ThF66JzZkeX+A='
WHERE
key_id = 'f418758da5762788325da88fca40d61d21c9dcf99a1038c9971cf64490f47108'
AND (
token = 'Q2P5pDAEIaaR1oK9EZgKjueukVDvp+ThF66JzZkeX+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)