UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7CtuIphJRHP0/hB34KR2PezVWSRwKmAYKN+pJAHc1Jk='
WHERE
key_id = '32c2eaa48500379e3e7afa18c703af61acbc650113f0a21750b12a77d57d8ece'
AND (
token = '7CtuIphJRHP0/hB34KR2PezVWSRwKmAYKN+pJAHc1Jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)