UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6NwsRN7KnQgzLq/B5UhQnW90iD8QD0+p0pYIk2sCWEk='
WHERE
key_id = '9df81277e600edeacf500fe2f1f426e304f3bf3d99c04abccb060ec481e6ee88'
AND (
token = '6NwsRN7KnQgzLq/B5UhQnW90iD8QD0+p0pYIk2sCWEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)