UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fjf8G1mb43YkQQHf9Mu+hxGU5y5XaGeXPHv7a4yIEws='
WHERE
key_id = '01d0a9c63f917b18e0a4e95fce05f0847cc187e840ac99918b2b4dc1f523ab11'
AND (
token = 'fjf8G1mb43YkQQHf9Mu+hxGU5y5XaGeXPHv7a4yIEws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)