UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zs8JsJ5o5MeIsMyIFAQw4jmdz01yxZyBneXCIZ8pZwk='
WHERE
key_id = '8adef41df78e049871bdd24266578e2bab091d35b715f533b9fa49a938299e1c'
AND (
token = 'Zs8JsJ5o5MeIsMyIFAQw4jmdz01yxZyBneXCIZ8pZwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)