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