UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CTmuATVMilQZMn6Q+WSZ/t8msHbRWFooTojWV23fOAc='
WHERE
key_id = 'a96dd4dbd07d25adaa56f4d86be11110d216d26e9c45803590aa58c755205cbd'
AND (
token = 'CTmuATVMilQZMn6Q+WSZ/t8msHbRWFooTojWV23fOAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)