UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9vs731nMmKsgSfrC2p+NoiJ3Yj2Zqsu7CvDv+0fYwys='
WHERE
key_id = 'e5ba28245a231448902a30b43889b7c8f998efafd0189016a81c2bc71c8cf609'
AND (
token = '9vs731nMmKsgSfrC2p+NoiJ3Yj2Zqsu7CvDv+0fYwys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)