UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XOdnpnsZZxQx1p95j8Co+QQHyctY8ORXibo2YTfUl14='
WHERE
key_id = '0f9d8e18d828058d72cfd44155adefe228b27156bac7f5de3ccb0b7a0f29855f'
AND (
token = 'XOdnpnsZZxQx1p95j8Co+QQHyctY8ORXibo2YTfUl14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)