UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XaC/OG4eAtneftJMbfMFGxw32wNerTee7m9pEU0Lmh8='
WHERE
key_id = 'f687cc91d0ccab5d67c3129234d5627f2d41ea2cce50159539cb5df7ce5b5433'
AND (
token = 'XaC/OG4eAtneftJMbfMFGxw32wNerTee7m9pEU0Lmh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)