UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S1GsxYTumkDsh8nKli6mrfTrljEE1cz0HpUyKZjN2aE='
WHERE
key_id = 'd24696db833e8775662da5c1d0d6c67f31affb2ae3d6f57715ce3f9094d02534'
AND (
token = 'S1GsxYTumkDsh8nKli6mrfTrljEE1cz0HpUyKZjN2aE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)