UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ch7JYGlrkeIBHp7s/aewaYbO4hqcbUibInOv3EimKIQ='
WHERE
key_id = '9b3e2aeb66648255c65a1010e34bd5e6bd7b685d59e4ab649706d1da5b3fe7c7'
AND (
token = 'ch7JYGlrkeIBHp7s/aewaYbO4hqcbUibInOv3EimKIQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)