UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wGsefV0bbXp202Rxk3EfNc7JuiFGa7VOobXJ59PlbHY='
WHERE
key_id = '87ad377129474a135a596c840893440c93aaba1b1f45c00d6593672fa116fe65'
AND (
token = 'wGsefV0bbXp202Rxk3EfNc7JuiFGa7VOobXJ59PlbHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)