UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'as3zXlADnDt3nE0Alc3LexI9tsMDy4yUyrM9O+tvJyQ=' 
WHERE 
  key_id = 'be78ec46824d05260d14e16d36605f289e3774c01bca5f5de60476bf722b1b95' 
  AND (
    token = 'as3zXlADnDt3nE0Alc3LexI9tsMDy4yUyrM9O+tvJyQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041