UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MbPhUxcxezZZ2dnyxHgHJsdQdPjog256P2yY1UTiuNw='
WHERE
key_id = '85c8272fc7849a03b2bc256427a565279a059defcbec49adaea7d7d12076e39c'
AND (
token = 'MbPhUxcxezZZ2dnyxHgHJsdQdPjog256P2yY1UTiuNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)