UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XHqWv5piix/4cOxyK3FS0Y8na3/TN4ic3+WQDB16K2Y='
WHERE
key_id = '6960e8ae4317fee49d4ae908ddda9d717359094a4bccece407da00aab36e1a4f'
AND (
token = 'XHqWv5piix/4cOxyK3FS0Y8na3/TN4ic3+WQDB16K2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)