UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T0c9upd+EuSTTgQamJj7XO79lT78V3JR64ttLR19aos='
WHERE
key_id = 'c4c24a86a97dc35730823802a632aac05d4f45f665feb3b2463a4e00554055cd'
AND (
token = 'T0c9upd+EuSTTgQamJj7XO79lT78V3JR64ttLR19aos='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)