UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Uva2D309qwje51OyW/i4rpvm+ofWYhyiIwAml0L9a/k='
WHERE
key_id = '30f0ea6f60206de50258741ca9eb45434f643ae22f72fc946a4227f9a07ec382'
AND (
token = 'Uva2D309qwje51OyW/i4rpvm+ofWYhyiIwAml0L9a/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)