UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j8hWeeEpP3VWXBXZuqEbvYRaRAblSaE86NinMH2BjHc='
WHERE
key_id = '6595d5bab45f7026e87bde280f6efa82e687b941c4b333ee363b19c40f89b173'
AND (
token = 'j8hWeeEpP3VWXBXZuqEbvYRaRAblSaE86NinMH2BjHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)