UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CPsiRY7WMK46iYMDvLV9/Nl+z4ZWGVpi8F7Cmr9b5c0='
WHERE
key_id = '66c4b35d4988fcb29e40955159c7766c3d260c2a4991364119461667a66fa913'
AND (
token = 'CPsiRY7WMK46iYMDvLV9/Nl+z4ZWGVpi8F7Cmr9b5c0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)