UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u8XE2I4AF/NLX5QAZqcQ4GTbidRI+0JcwBHuRSmE01w='
WHERE
key_id = 'be5ef5d46b209bd04a76d964bc56752e76e32e3a589675ccc515dacacf7a03eb'
AND (
token = 'u8XE2I4AF/NLX5QAZqcQ4GTbidRI+0JcwBHuRSmE01w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)