UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dxjIQhHJwssIwmJacf1AXCCXa3dD9hCxPz+WtqlTpMs='
WHERE
key_id = 'bef2fe853e4c4c57e733992b76b2b21daf0551633ffe3161e6733e7dda8c724c'
AND (
token = 'dxjIQhHJwssIwmJacf1AXCCXa3dD9hCxPz+WtqlTpMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)